From 23025393a6444f8b92eb09c567e49c15322d4b92 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 11 Mar 2006 20:34:37 +0000 Subject: [PATCH] Use Polygon() for outlined polygons, too. Same idea as in 2006-03-11 Tor Lillqvist * gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for outlined polygons, too. Same idea as in draw_rectangle(): Set pen to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH if drawing a polygon outline. (#332662) (gdk_win32_draw_polygon): Corresponding simplification: no need to add an extra final copy of the starting point. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ gdk/win32/gdkdrawable-win32.c | 28 +++++++++------------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index eab550ed8c..c5d598f472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-03-11 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for + outlined polygons, too. Same idea as in draw_rectangle(): Set pen + to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH + if drawing a polygon outline. (#332662) + (gdk_win32_draw_polygon): Corresponding simplification: no need to + add an extra final copy of the starting point. + 2006-03-11 Dom Lachowicz * modules/engines/ms-windows: Speed up the Windows theme diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index eab550ed8c..c5d598f472 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2006-03-11 Tor Lillqvist + + * gdk/win32/gdkdrawable-win32.c (draw_polygon): Use Polygon() for + outlined polygons, too. Same idea as in draw_rectangle(): Set pen + to NULL_PEN if drawing a filled polygon, set brush to HOLLOW_BRUSH + if drawing a polygon outline. (#332662) + (gdk_win32_draw_polygon): Corresponding simplification: no need to + add an extra final copy of the starting point. + 2006-03-11 Dom Lachowicz * modules/engines/ms-windows: Speed up the Windows theme diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 8c8d4fe401..d14dfc1d88 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -994,7 +994,7 @@ draw_polygon (GdkGCWin32 *gcwin32, { gboolean filled; POINT *pts; - HPEN old_pen; + HGDIOBJ old_pen_or_brush; gint npoints; gint i; @@ -1010,16 +1010,14 @@ draw_polygon (GdkGCWin32 *gcwin32, } if (filled) - { - old_pen = SelectObject (hdc, GetStockObject (NULL_PEN)); - if (old_pen == NULL) - WIN32_GDI_FAILED ("SelectObject"); - GDI_CALL (Polygon, (hdc, pts, npoints)); - if (old_pen != NULL) - GDI_CALL (SelectObject, (hdc, old_pen)); - } + old_pen_or_brush = SelectObject (hdc, GetStockObject (NULL_PEN)); else - GDI_CALL (Polyline, (hdc, pts, npoints)); + old_pen_or_brush = SelectObject (hdc, GetStockObject (HOLLOW_BRUSH)); + if (old_pen_or_brush == NULL) + WIN32_GDI_FAILED ("SelectObject"); + GDI_CALL (Polygon, (hdc, pts, npoints)); + if (old_pen_or_brush != NULL) + GDI_CALL (SelectObject, (hdc, old_pen_or_brush)); } static void @@ -1046,7 +1044,7 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, bounds.width = 0; bounds.height = 0; - pts = g_new (POINT, npoints+1); + pts = g_new (POINT, npoints); for (i = 0; i < npoints; i++) { @@ -1062,14 +1060,6 @@ gdk_win32_draw_polygon (GdkDrawable *drawable, bounds.height = MAX (bounds.height, points[i].y - bounds.y); } - if (points[0].x != points[npoints-1].x || - points[0].y != points[npoints-1].y) - { - pts[npoints].x = points[0].x; - pts[npoints].y = points[0].y; - npoints++; - } - region = widen_bounds (&bounds, GDK_GC_WIN32 (gc)->pen_width); generic_draw (drawable, gc, -- 2.30.2